package com.usf.jprovider.schema.connector;

import com.usf.jprovider.constants.Constants;

public final class SQLServerConnector extends AbstractConnector {

	public SQLServerConnector() {
		super(Constants.SQLSERVER_DRIVER);
	}
	
	@Override
	public String IntegerFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String DoubleFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String DateFormater(String value, String format) {
		return "'" + value + "'"; //TODO Danger check
	}
	@Override
	public String StringFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String FileSourceFormater(String value) {
		return "'" + value + "'";
	}

	@Override
	public String selectRandomize(String table, String column) {
		String query = "SELECT DISTINCT " + column + " FROM " + table + 
				" ORDER BY NEWID()";
		return query;
	}
	@Override
	public String selectRandomize(String table, String column, String queryValue) {
		String query = "SELECT DISTINCT " + column + " FROM " + table + "WHERE " + column + " " + queryValue + 
				" ORDER BY NEWID()";
		return query;
	}

	@Override
	public String selectRandomize(String query) {
		return query + " ORDER BY NEWID()";//TODO DISTINCT 
	}

	@Override
	public String nextSequenceQuery(String name) {
		return "SELECT NEXT VALUE FOR " + name;
	}

}
